package object.homework;

public class ObjectDemo {
    public static void main(String[] args) {
        Point p = new Point(1, 2);
        System.out.println(p.toString());

        //任何类型与字符串的连接，结果都是字符串
        String s = "你好" + p;
        System.out.println(s);


        Point p1 = new Point(1, 2);
        Point p2 = new Point(1, 2);
        System.out.println(p1 == p2);//false
        System.out.println(p1.equals(p2));//false -> true

        StringBuilder p3 = new StringBuilder("helloWorld");
        StringBuilder p4 = new StringBuilder("helloWorld");
        String p5 = new String("helloWorld");
        System.out.println(p3 == p4);//false
        System.out.println(p3.equals(p4));//false

        System.out.println(p1.equals(p5));//false,类型不同

    }
}
